package main

import (
	"gitee.com/enjoy_5/comment-rpc/constant"
	"gitee.com/enjoy_5/comment-rpc/internal/api/service"
	"gitee.com/enjoy_5/comment-rpc/internal/model/comment"
	"gitee.com/enjoy_5/comment-rpc/internal/model/migrate"
	grpc1 "gitee.com/xuxinzhi2206/corehub/grpc"
	viper1 "gitee.com/xuxinzhi2206/corehub/viper"
	"google.golang.org/grpc"
)

func init() {
	err := viper1.GetViper(constant.YamlLocation)
	if err != nil {
		return
	}
	err = migrate.AutoMigrate(
		&comment.Comment{},           //评论
		&comment.RecordCommentLike{}, //评论点赞记录
	)
	if err != nil {
		panic(err)
	}
}

func main() {
	err := grpc1.RegisterRPC(func(s *grpc.Server) {
		//注册
		service.Register(s)
	})
	if err != nil {
		panic(err)
	}
}
